export {
    Cookie
}
function Cookie(params) {
    //设置cookie
    this.set = function (name, value, day) {
        var date = new Date();
        date.setDate(date.getDate() + day);
        console.log(date);
        document.cookie =
            name + "=" + value + ";expires=" + date.toGMTString() + ";path=/";
    };
    //获取cookie的keys和values
    this.getDatas = function () {
        let cookie = document.cookie.split(";");
        cookie=cookie.map(item=>{
            return item.trim()
        })
        let keys = [];
        let values = [];
        let Data = {
            keys,
            values
        };
        cookie.forEach((item, index, arr) => {
            keys.push(item.split("=")[0]);
            values.push(item.split("=")[1]);
        });
        console.log(cookie)
        // cookie
        return Data;
    };
    //清空cookie
    this.clearAll=function (params) {
        this.getDatas().keys.forEach(item=>{
            this.set(item,'',-1)
        })
    }

}